import request from '@/utils/request'
import removeToken from '@/utils/auth'
export function login(data) {
  const form = {
    username: data.username,
    password: data.password,
    grant_type: 'password',
    scope: 'read'
  }
  return request({
    url: '/authorization-server/oauth/token',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': 'Basic dGVzdF9jbGllbnQ6dGVzdF9zZWNyZXQ='
    },
    method: 'post',
    params: form
  })
}

export function getInfo(name) {
  return request({
    url: '/organization/user',
    method: 'get',
    params: { uniqueId: name }
  })
}

export function logout() {
  // removeToken()
  return Promise.resolve({
    code: '000000',
    mesg: '成功',
    time: new Date()
  })
  /* return request({
    url: '/user/logout',
    method: 'post'
  })*/
}
